//
//  HomeCollectionCell.swift
//  许鲜
//
//  Created by hbl on 16/4/24.
//  Copyright © 2016年 hbl. All rights reserved.
//

import UIKit
import YYWebImage

class HomeCollectionCell: UICollectionViewCell {
    @IBOutlet weak var photoImageView: UIImageView!
    @IBOutlet weak var discountImageView: UIImageView!
    @IBOutlet weak var priceLabel: UILabel!
    @IBOutlet weak var realPriceLabel: UILabel!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var soldOutImageView: UIImageView!
    var goods:GoodsModel?{
        didSet{
        soldOutImageView.hidden = true
        photoImageView.yy_setImageWithURL(NSURL(string: (goods?.icon)!), placeholder: UIImage(named: "AppIcon"))
        discountImageView.yy_setImageWithURL(NSURL(string: (goods?.tipsimg)!), placeholder: UIImage(named: "AppIcon"))
        priceLabel.text = goods?.market_price
        realPriceLabel.text = goods?.laouser
        titleLabel.text = goods?.title
        realPriceLabel.font = UIFont.systemFontOfSize(16, weight: 1)
            if goods?.store_nums == goods?.sold_num {
                soldOutImageView.hidden = false
            }
        }
    }
}
